import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ysq";
// 查询新闻列表
export function listPress(query) {
  return request({
    url: '/content/press/list',
    method: 'get',
    params: query
  })
}

// 查询新闻详细
export function getPress(id) {
  return request({
    url: '/content/press/'+ parseStrEmpty(id),
    method: 'get'
  })
}

// 新增新闻
export function addPress(data) {
  return request({
    url: '/content/press',
    method: 'post',
    data: data
  })
}

// 修改新闻
export function updatePress(data) {
  return request({
    url: '/content/press',
    method: 'put',
    data: data
  })
}

// 删除新闻
export function delPress(id) {
  return request({
    url: '/content/press/' + id,
    method: 'delete'
  })
}

export function getScoedtype(val) {
  return request({
    url: '/content/press/getSecondType/' + val,
    method: 'get'
  })
}

// 新增时查询新闻一级分类
export function getType() {
  return request({
    url: '/content/press/getType',
    method: 'get'
  })
}

// 新增时查询企业名片一级分类
export function getCardType(query) {
  return request({
    url: '/content/press/getType',
    method: 'get',
    params: query
  })
}


// 根据文章url获取文章内容
export function addContent(url, id) {
  const data = {
   url,
   id
  }
  return request({
    url: '/content/press/addContent',
    method: 'put',
    data: data
  })
}

export function changStatus(id) {
  return request({
    url: '/content/press/changStatus/' + id,
    method: 'post'
  })
}

